<template>
  <div>
    <div class="flex between">
      <div class="crumbs">
        <router-link to="/">首页</router-link>/
        <span>审批中心</span> /
        <span>施工单位管理</span> /
        <span class="active">施工单位</span>
      </div>
      <div class="flex between" style="width: 18%;">
        <div v-for="item in 3" :key="item" class="flex center">
          <div
            class="iconfont mr-10 fs-18"
            v-html="state.get(item).icon"
            :style="{ color: state.get(item).color }"
          ></div>
          <div>{{ state.get(item).name }}</div>
        </div>
      </div>
    </div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column type="index" label="序号" align="center"></el-table-column>
      <el-table-column prop="name" label="单位名称" align="center"></el-table-column>
      <el-table-column label="营业执照" align="center">
        <template slot-scope="scope">
          <div
            class="iconfont mr-10 fs-18"
            v-html="state.get(scope.row.state).icon"
            :style="{ color: state.get(scope.row.state).color }"
          ></div>
        </template>
      </el-table-column>
      <el-table-column label="资质证书" align="center">
        <template slot-scope="scope">
          <div
            class="iconfont mr-10 fs-18"
            v-html="state.get(scope.row.state).icon"
            :style="{ color: state.get(scope.row.state).color }"
          ></div>
        </template>
      </el-table-column>
      <el-table-column prop="date" label="资质类别" align="center"></el-table-column>
      <el-table-column label="安全生产许可证" align="center">
        <template slot-scope="scope">
          <div
            class="iconfont mr-10 fs-18"
            v-html="state.get(scope.row.state).icon"
            :style="{ color: state.get(scope.row.state).color }"
          ></div>
        </template>
      </el-table-column>
      <el-table-column prop="date" label="入驻时间" align="center"></el-table-column>
      <el-table-column label="施工评分" align="center">
        <template slot-scope="scope">
          <el-rate
            :value="scope.row.rate"
            disabled
            allow-half
            score-template="{value}"
            :colors="['#6dbc71','#6dbc71','#6dbc71']"
          ></el-rate>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button size="small" type="primary" @click="handleDetail(scope.row)">查看</el-button>
          <el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData: [
        {
          name: "山东某某建筑工程有限公司",
          type: "动火作业",
          content: "111",
          date: "2024-05-21",
          state: 1,
          rate: 5
        },
        {
          name: "山东某某建筑工程有限公司",
          type: "动火作业",
          content: "111",
          date: "2024-05-21",
          state: 2,
          rate: 4.5
        },
        {
          name: "山东某某建筑工程有限公司",
          type: "动火作业",
          content: "111",
          date: "2024-05-21",
          state: 3,
          rate: 3
        },
        {
          name: "山东某某建筑工程有限公司",
          type: "动火作业",
          content: "111",
          date: "2024-05-21",
          state: 4,
          rate: 1
        },
        {
          name: "山东某某建筑工程有限公司",
          type: "动火作业",
          content: "111",
          date: "2024-05-21",
          state: 5,
          rate: 4.9
        }
      ],
      state: new Map([
        [1, { name: "正常", icon: "&#xe614;", color: "#6dbc71" }],
        [2, { name: "未上传", icon: "&#xe678;" }],
        [3, { name: "已过期", icon: "&#xe7a0;", color: "#fb6c6c" }]
      ])
    };
  },
  methods: {
    handleDetail() {
      this.$router.push("/ApprovalCenter/constructionUnit/detail");
    },
    handleDelete() {}
  }
};
</script>

<style></style>